package com.lu.core.auto;

import com.lu.core.annotations.EnableDataScope;
import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AdviceModeImportSelector;

/**
 * @program sample-demo
 * @description:
 * @author: zhanglu
 * @create: 2021-03-10 18:38:00
 */
public class DataScopeConfigureSelector extends AdviceModeImportSelector<EnableDataScope> {

    private static final String ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME =
            "com.lu.core.auto.DataScopeProxyAutoConfiguration";

    @Override
    protected String[] selectImports(AdviceMode adviceMode) {
        switch (adviceMode) {
            case PROXY:
                return new String[]{DataScopeProxyAutoConfiguration.class.getName()};
            case ASPECTJ:
                return new String[]{ASYNC_EXECUTION_ASPECT_CONFIGURATION_CLASS_NAME};
            default:
                return null;
        }
    }

}
